////////////////////////////////////////////////////////////////////////////////
///////// Product Market Competition and Convertible Debt Financing ////////////
///////// Cheng Lei, Evgeny Lyandres, Chris Veld, Ying Xia /////////////////////
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
* Date: April 27, 2024
* This do file contains code generating results for Tables 2 to 4
* Please define the path for datasets and the path for storing results before running the following program. 
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////

********************************************************************************
* Table 1 Summary Statistics
********************************************************************************

* Starting with the firm-year sample 
* [Baseline_Firm_Year_Sample]

use "Path\Baseline_Firm_Year_Sample.dta", clear

* Panel A-C
outreg2 using [Table_1] , excel replace sum(detail)  keep(convo fconv1 fconv2 covdum fld size lage cash divd rep cf tangib capex mb rda Vol_12  ) dec(3)

* Convertible users' features, i.e., the summary statistics within the subsample of firms with outstanding convertible debt
tabstat fconv1 fconv2 if convo == 1, statistics (count mean sd min p25 median p75 max) column(statistics)
mean size if convo == 1
mean convo if sic3ind >= 200 & sic3ind <=399

* Panel D 
* Please see Section 4 in the paper for the detailed demonstration

* Use the sample including the average convertible debt variables for Fluidity quintiles where the average convertible debt variables for each Fluidity quintiles is pre-calculated using the FULL firm-year sample
* Report the time-series average for all convertible debt variables and associated High-minus-low differences
* [Average_Convertible_Full_Sample]

use "Path\Average_Convertible_Full_Sample.dta", clear

mean convom covm fconv1m fconv2m, over(frank)
ttest convom, by(dif)
ttest covm, by(dif)
ttest fconv1m, by(dif)
ttest fconv2m, by(dif)

* Use the sample including the average convertible debt variables for Fluidity quintiles where the average convertible debt variables for each Fluidity quintiles is pre-calculated using the SUBSAMPLE of Convertible users
* Report the time-series average for all convertible debt variables and associated High-minus-low differences
* [Average_Convertible_User_Sample]

use "Path\Average_Convertible_User_Sample.dta", clear

mean fconv1m fconv2m, over(frank)
ttest fconv1m, by(dif)
ttest fconv2m, by(dif)
********************************************************************************


////////////////////////////////////////////////////////////////////////////////
* The above codes generate the result, and the format of table is finalised in Excel. 
////////////////////////////////////////////////////////////////////////////////

